from .schemas.user import User, Users
from common.third_party.save_config import save_config, load_config


def get_user_role(username):
    config = load_config('auth/users_config', Users, Users())
    for user in config.users:
        if username == user.username:
            return user.user_role
    return User()


def get_user(username):
    config = load_config('auth/users_config', Users, Users())
    for user in config.users:
        if username == user.username:
            return user
    return User()
